import Vue from 'vue'

import Vuex from 'vuex'

import tools from "@/utils/tools.js"

Vue.use(Vuex)

const store = new Vuex.Store({
        state: {
                leftRowName: "",

                RHName: "",

                PFDName1: "",
                PFDName2: "",
                /**
                 * isCurrentNext:是否更改，是否可以往下进行flg，true-?可以往下进行，false-?禁止往下进行。--默认为true可以往下进行
                 * isCurrentFn:记录下次点击切换等操作的数据。以便成功后跳转。--默认为{}记录下次操作数据。
                 */
                isCurrentNext: true,
                isCurrentFn: null,
                /**
                  * isCurrentNext:是否更改，是否可以往下进行flg，true-?可以往下进行，false-?禁止往下进行。--默认为true可以往下进行
                  * isCurrentFn:记录下次点击切换等操作的数据。以便成功后跳转。
                  */


                btn_set_BHView: false,   //首页抽出按钮是否抽出
                btn_set_BHView1: true,   //首页抽出按钮是否抽出
                btn_set_BHView2: true,   //首页抽出按钮是否抽出baseTab5Flg
                baseTab5Flg: true,   //首页抽出按钮是否抽出
                DanDang: {
                        SecName1: ' ',
                        SecName2: ' ',
                        SecName3: ' ',
                },
                threeFlg: '',
                isStop: {
                        name: 'default',
                        flg: false,
                        next: 'default'
                },
                test: '',
                pltCode: '', //装置
                plantName: '', //装置名称
                prnCode: '',
                macType: 1, //类型 1 机器  2 配管
                ctgCode: '', // 机型ID
                ctgRowCode: '', // 每行的ctgCode
                lawCode: '', //法规ID
                proCode: '',
                macName: '',
                macNameb: '',
                macCode: '',
                realMacCode: '',

                bhdateCode: 2,
                bhStyleCode: 2,
                msStyleCode: 2,
                msDetailStyleCode: 2,
                rdStyleCode: 3,
                lifeAssBaseCode: '',
                planPeriodCode: '',

                colorOptionsCode: '',
                judgCode: '',
                positionCode: '0',
                checkCode: '',

                readColorOptionsValue: '',
                readColorOptionsValueSelect: '',
                readJudgValue: '',

                msTypeCode: 2,

                // excel模块 ---------
                excelPltCode: '', //装置
                excelPlantName: '', //装置名称
                excelMacType: 1, //类型 1 机器  2 配管
                excelCtgCode: '', //机型ID
                excelLawCode: '', //法规ID
                excelMacName: '', // 短
                excelMacNameb: '', //长

                // 3d 构件关联模块 --------
                threeRelationPltCode: '', //装置
                threeRelationPlantName: '', //装置名称
                threeRelationMacType: 1, //类型 1 机器  2 配管
                threeRelationCtgCode: '', //机型ID
                threeRelationLawCode: '', //法规ID
                threeRelationMacName: '', // 短
                threeRelationMacNameb: '', //长


                // pid 构件关联模块 --------
                pidPltCode: '', //装置
                pidPlantName: '', //装置名称
                pidMacType: 1, //类型 1 机器  2 配管
                pidCtgCode: '', //机型ID
                pidLawCode: '', //法规ID
                pidMacName: '', // 短
                pidMacNameb: '', //长

                // 目视详细
                ispPurSourceKey: 0,
                // 计划表示期间
                planningTimeKey: 0,
                // 计划key
                filterPlanKey: 'B_EXE',

                msDetailRadio: '2',

                MSC_Info: {},
                /**
                 * 目视详情-结果详情-次会计划页面INFO
                 */
                ISP_INfo: {
                        posNo: ''        //预防报错
                },
                RH_INfo: {
                        posNo: ''        //预防报错
                },
                TH_INfo_view1Info: {
                },
                TH_INfo_view2Info: {
                },
                TH_INfo_viewComboxList: [],
                TH_INfo_POS_NO: {
                }
        },
        mutations: {

                /**
                 * isCurrentNext:是否更改，是否可以往下进行flg，true-?可以往下进行，false-?禁止往下进行。--默认为true可以往下进行
                 * isCurrentFn:记录下次点击切换等操作的数据。以便成功后跳转。--默认为{}记录下次操作数据。
                 * this.$store.commit("changeIsCurrentNext", this.isChangeFlg);
                 */

                changeIsCurrentNext(state, isCurrentNext) {
                        state.isCurrentNext = isCurrentNext
                },
                changeIsCurrentFn(state, isCurrentFn) {
                        state.isCurrentFn = isCurrentFn
                },
                reSetIsCurrent(state) {
                        state.isCurrentNext = true;
                        state.isCurrentFn = null;
                },
                /**
                 * isCurrentNext:是否更改，是否可以往下进行flg，true-?可以往下进行，false-?禁止往下进行。--默认为true可以往下进行
                 * isCurrentFn:记录下次点击切换等操作的数据。以便成功后跳转。--默认为{}记录下次操作数据。
                 */

                reSetIsStop(state, isStop) {
                        state.isStop = {
                                name: 'default',
                                flg: false,
                                next: 'default'
                        }
                },
                /**
                 * 目视详情-结果详情-次会计划页面INFO
                 */
                changeISP_Info(state, ISP_INfo) {
                        state.ISP_INfo = ISP_INfo
                },

                changeMSC_Info(state, MSC_Info) {
                        state.MSC_Info = MSC_Info
                },
                //装置id更新
                changePltCode(state, pltCode) {
                        localStorage.setItem('pltCode', pltCode)
                        state.pltCode = pltCode
                        state.excelPltCode = pltCode
                },
                //装置名称更新
                changePlantName(state, plantName) {
                        state.plantName = plantName
                },
                changePrnCode(state, prnCode) {
                        state.prnCode = prnCode
                },
                //类型更新
                changeMacType(state, macType) {
                        state.macType = parseInt(macType)
                        state.excelMacType = parseInt(macType)
                },
                //机型ID更新
                changeCtgCode(state, ctgCode) {
                        state.ctgCode = ctgCode
                },
                changeRowCtgCode(state, ctgRowCode) {
                        state.ctgRowCode = ctgRowCode
                },
                //法规id更新
                changeLawCode(state, lawCode) {
                        state.lawCode = lawCode
                },
                changeMacName(state, macName) {
                        state.macName = macName
                },
                changeMacNameb(state, macNameb) {
                        state.macNameb = macNameb
                        state.excelMacName = macNameb
                },
                changeMacCode(state, macCode) {
                        state.macCode = macCode
                },
                changeRealMacCode(state, realMacCode) {
                        state.realMacCode = realMacCode
                },
                //修改BH日期
                changeBHDate(state, bhdateCode) {
                        state.bhdateCode = bhdateCode
                },
                changeBHStyleCode(state, bhStyleCode) {
                        state.bhStyleCode = bhStyleCode
                },
                changeMSStyleCode(state, msStyleCode) {
                        state.msStyleCode = msStyleCode
                },
                changeMSDetailStyleCode(state, msDetailStyleCode) {
                        state.msDetailStyleCode = msDetailStyleCode
                },
                changeRDStyleCode(state, rdStyleCode) {
                        state.rdStyleCode = rdStyleCode
                },
                changeLifeAssBaseCode(state, lifeAssBaseCode) {
                        state.lifeAssBaseCode = lifeAssBaseCode
                },
                changeplanPeriodCode(state, planPeriodCode) {
                        state.planPeriodCode = planPeriodCode
                },
                //更新腐蚀率
                changeColorOptionsCode(state, colorOptionsCode) {
                        state.colorOptionsCode = colorOptionsCode
                },
                //更新腐蚀率的值
                changeJudgCode(state, judgCode) {
                        state.judgCode = judgCode
                },
                //更新检查区分
                changeCheckCode(state, checkCode) {
                        state.checkCode = checkCode
                },
                //部位更新
                changePositionCode(state, positionCode) {
                        state.positionCode = positionCode
                },
                //阅览腐蚀率颜色筛选
                changeReadColorOptionsValue(state, readColorOptionsValue) {
                        state.readColorOptionsValue = readColorOptionsValue
                },
                changeReadColorOptionsValueSelect(state, readColorOptionsValueSelect) {
                        state.readColorOptionsValueSelect = readColorOptionsValueSelect
                },
                changeReadJudgValue(state, readJudgValue) {
                        state.readJudgValue = readJudgValue
                },
                //目视表示code更新
                changeMsTypeCode(state, msTypeCode) {
                        state.msTypeCode = msTypeCode
                },

                // ----------- excel模块 -------------------
                changeExcelMacName(state, excelMacName) {
                        state.excelMacName = excelMacName
                        state.macNameb = excelMacName
                },
                changeExcelMacNameb(state, excelMacNameb) {
                        state.excelMacNameb = excelMacNameb
                },

                // 装置id更新
                changeExcelPltCode(state, excelPltCode) {
                        state.excelPltCode = excelPltCode
                        state.pltCode = excelPltCode
                },

                //装置名称
                changeExcelPlantName(state, excelPlantName) {
                        state.excelPlantName = excelPlantName
                },
                //类型更新
                changeExcelMacType(state, excelMacType) {
                        state.excelMacType = excelMacType
                        state.macType = Number(excelMacType)
                },
                //机种id更新
                changeExcelCtgCode(state, excelCtgCode) {
                        state.excelCtgCode = excelCtgCode
                },
                // 法规id更新
                changeExcelLawCode(state, excelLawCode) {
                        state.excelLawCode = excelLawCode
                },

                // 目视详细检查目的key更新
                changeIspPurSourceKey(state, ispPurSourceKey) {
                        state.ispPurSourceKey = ispPurSourceKey
                },
                // 目视计划表示期间key更新
                changePlanningTimeKey(state, planningTimeKey) {
                        state.planningTimeKey = planningTimeKey
                },

                changeFilterPlanKey(state, filterPlanKey) {
                        state.filterPlanKey = filterPlanKey
                },
                changeMsDetailRadio(state, msDetailRadio) {
                        state.msDetailRadio = msDetailRadio
                },


                // ----------- ThreeRelation模块 -------------------
                // 3d 构件关联模块 --------
                // threeRelationPltCode: '', //装置
                // threeRelationPlantName: '', //装置名称
                // threeRelationMacType: 1, //类型 1 机器  2 配管
                // threeRelationCtgCode: '', //机型ID
                // threeRelationLawCode: '', //法规ID
                // threeRelationMacName: '', // 短
                // threeRelationMacNameb: '', //长

                changeThreeRelationMacName(state, threeRelationMacName) {
                        state.threeRelationMacName = threeRelationMacName
                },
                changeThreeRelationMacNameb(state, threeRelationMacNameb) {
                        state.threeRelationMacNameb = threeRelationMacNameb
                },
                // 装置id更新
                changeThreeRelationPltCode(state, threeRelationPltCode) {
                        state.threeRelationPltCode = threeRelationPltCode
                },
                //装置名称
                changeThreeRelationPlantName(state, threeRelationPlantName) {
                        state.threeRelationPlantName = threeRelationPlantName
                },
                //类型更新
                changeThreeRelationMacType(state, threeRelationMacType) {
                        state.threeRelationMacType = threeRelationMacType
                },
                //机种id更新
                changeThreeRelationCtgCode(state, threeRelationCtgCode) {
                        state.threeRelationCtgCode = threeRelationCtgCode
                },
                // 法规id更新
                changeThreeRelationLawCode(state, threeRelationLawCode) {
                        state.threeRelationLawCode = threeRelationLawCode
                },

                // ----------- pid模块 -------------------
                // pid 构件关联模块 --------
                // pidPltCode: '', //装置
                // pidPlantName: '', //装置名称
                // pidMacType: 1, //类型 1 机器  2 配管
                // pidCtgCode: '', //机型ID
                // pidLawCode: '', //法规ID
                // pidMacName: '', // 短
                // pidMacNameb: '', //长

                changePidMacName(state, pidMacName) {
                        state.pidMacName = pidMacName
                },
                changePidMacNameb(state, pidMacNameb) {
                        state.pidMacNameb = pidMacNameb
                },
                // 装置id更新
                changePidPltCode(state, pidPltCode) {
                        state.pidPltCode = pidPltCode
                },
                //装置名称
                changePidPlantName(state, pidPlantName) {
                        state.pidPlantName = pidPlantName
                },
                //类型更新
                changePidMacType(state, pidMacType) {
                        state.pidMacType = pidMacType
                },
                //机种id更新
                changePidCtgCode(state, pidCtgCode) {
                        state.pidCtgCode = pidCtgCode
                },
                // 法规id更新
                changePidLawCode(state, pidLawCode) {
                        state.pidLawCode = threeRelationLawCode
                },


        },
        actions: {

        }
})

export default store